from django.urls import path
from . import views
from .views import (
    ImageUploadView, UserImagesView, VideoUploadView, UserVideosView,
    ResultList, VideoHistoryList, DetectVideoView, video_detection_results
)

app_name = 'detection'

urlpatterns = [
    # 图片检测相关
    path('images/upload/', ImageUploadView.as_view(), name='image-upload'),
    path('images/', UserImagesView.as_view(), name='user-images'),
    
    # 视频检测相关
    path('videos/upload/', VideoUploadView.as_view(), name='video-upload'),
    path('videos/', UserVideosView.as_view(), name='user-videos'),
    path('videos/history/', VideoHistoryList.as_view(), name='video-history-list'),
    path('videos/detect/', DetectVideoView.as_view(), name='video-detect'),
    path('videos/<int:video_id>/detections/', video_detection_results, name='video-detection-results'),
    
    # 数据统计相关
    path('statistics/realtime/', views.get_realtime_data, name='get_sessions'),
    path('statistics/video/', views.get_video_detection_history, name='video_detection_history'),
    path('statistics/realtime/last/', views.get_last_realtime_detection, name='last_realtime_detection'),
    path('statistics/video/last/', views.get_last_video_detection, name='last_video_detection'),
    path('statistics/realtime/day/<str:date>/', views.get_day_realtime_data, name='get_day_realtime_data'),
    path('statistics/video/day/<str:date>/', views.get_day_video_data, name='get_day_video_data')
]
